package com.ossean.match.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.ossean.match.model.RelativeMemoToOpenSourceProject;

public interface RelativeMemoToOpenSourceProjectDao {
	
	//读取项目id对应的所有关联的帖子
	@Select("select * from relative_memo_to_open_source_projects_new where osp_id=#{osp_id}")
	public List<RelativeMemoToOpenSourceProject> getRelativeMemosByOspId(@Param("osp_id") int osp_id);
		
	//写入匹配结果
	@Insert("insert ignore into ${targetTableName} (osp_id,relative_memo_id,match_weight,match_time) values (#{item.osp_id},#{item.relative_memo_id},#{item.match_weight},now())")
	public void insertMatchResult(@Param("targetTableName") String targetTableName, @Param("item") RelativeMemoToOpenSourceProject item);
	
	//写入匹配结果
	@InsertProvider(type = RelativeMemoToOpenSourceProjectDaoProvider.class, method = "insertAll")
	public void insertMatchResultBatch(@Param("targetTableName") String targetTableName, @Param("list") List<RelativeMemoToOpenSourceProject> list);

}
